All Questions
14 questions
4votes
4answers
1kviews
Power of two integers
Challenge: Given a positive integer which fits in a \$32\$ bit signed integer, find if it can be expressed as \$A^P\$ where \$P > 1\$ and \$A > 0\$. A and P both should be integers. ...
4votes
3answers
6kviews
Google Foobar bomb_baby
This is the question I am facing at level 3 of Google Foobar: There are two types: Mach bombs (M) and Facula bombs (F). The bombs, once released into the LAMBCHOP's inner workings, will ...
2votes
2answers
9kviews
Count the number of ways an integer can be represented as a sum of consecutive positive integers
I am trying to count the number of ways an integer can be represented as sum of 2 or more consecutive positive integers. My Code is working in under 1 second for small inputs (\$\le 10^7\$) but after ...
5votes
2answers
1kviews
Inti Sets: Hackerank
Here is the original question. In order to motivate his Peruvian students, a teacher includes words in the Quechua language in his math class. Today, he defined a curious set for a given ...
1vote
2answers
81views
Find the highest product between elements in a set [closed]
I'm solving a programming challenge that essentially consists of finding the highest product of elements in a set. This is my current solution, and is passing all the test cases but one. The test ...
3votes
2answers
996views
Finding the last ten digits of \$\sum_{n=1}^{1000} n^n\$
This is my solution to Project Euler Problem 48. Problem: The series, \$1^1 + 2^2 + 3^3 + ... + 10^{10} = 10405071317\$ . Find the last ten digits of the series, \$1^1 + 2^2 + 3^3 + ... + ...
10votes
2answers
540views
Project Euler Problem 530: sum of sum of greatest common divisors
Here is a description of Project Euler problem 530: Every divisor \$d\$ of a number \$n\$ has a complementary divisor \$n/d\$. Let \$f(n)\$ be the sum of the greatest common divisor of \$d\$ ...
2votes
2answers
486views
Project Euler #12 Java implementation
The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be: 1, 3, 6, 10, 15, 21, 28, ...
1vote
1answer
531views
Project Euler #11 Java implementation
Project Euler 11 Solution in Java. The problem is at https://projecteuler.net/problem=11 ...
3votes
2answers
457views
Mystery sum with placeholder digits
I came across this coding problem. Back in primary school, maybe you were sometimes asked to solve a fill-in-the-blank sum - or "mystery sum" - in which certain digits are removed and you had to ...
1vote
1answer
1kviews
Optimizing my solution for problem #23 - project Euler
The question - A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + ...
7votes
3answers
262views
Project Euler #5 (LCM 1 - 20) Follow up
I'm actually spending time on it, unlike the first time and going through, understanding and implementing the several suggestions I've landed on two different approaches. Approach 1: Employing Java 8 ...
5votes
4answers
5kviews
Project Euler #5 (LCM of 1-20)
Challenge: 2520 is the smallest number divisible by 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by 1-20? Solution: ...
3votes
3answers
2kviews
General solution to sum multiples of multiple numbers below a limit
sumMultiples() is a working general solution to Project Euler's first problem. Don't read it if you want to try it yourself. This question is about preserving ...